import 'dart:io';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:tender_flutter/constant/app_constant.dart';
import 'package:tender_flutter/constant/theme_colors.dart';
import 'package:tender_flutter/router/router.dart';
import 'package:tender_flutter/router/router_map.gr.dart';
import 'package:tender_flutter/utils/screen_adaper.dart';

class PrivacyAgreementDialog extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return _initBody(context);
  }

  Widget _initBody(BuildContext context) {
    return Center(
        child: Container(
      width: ScreenAdapter.width(600),
      padding: EdgeInsets.only(
          top: ScreenAdapter.height(40), bottom: ScreenAdapter.height(40)),
      decoration: BoxDecoration(
          color: ThemeColors.colorWhite, // 底色
          boxShadow: [
            BoxShadow(
              blurRadius: 10, //阴影范围
              spreadRadius: 0.5, //阴影浓度
              color: Color(0xFF000000), //阴影颜色
            ),
          ],
          borderRadius: BorderRadius.circular(ScreenAdapter.width(15))),
      child: Column(mainAxisSize: MainAxisSize.min, children: [
        Text("用户隐私政策概要",
            style: TextStyle(
                color: ThemeColors.colorType24,
                fontSize: ScreenAdapter.sp(33),
                fontWeight: FontWeight.bold)),
        Container(
            margin: EdgeInsets.symmetric(
                vertical: ScreenAdapter.height(30),
                horizontal: ScreenAdapter.height(40)),
            child: RichText(
                text: TextSpan(
              text: '欢迎您使用权鸟夺标程序!权鸟夺标程序是由权鸟科技提供的用于招投标搜索以及招投标相关业务的产品，我们将通过',
              style: TextStyle(
                  fontSize: ScreenAdapter.sp(30),
                  color: ThemeColors.colorType1,
                  fontWeight: FontWeight.w500),
              children: <TextSpan>[
                TextSpan(
                    text: '《用户协议》',
                    style: TextStyle(
                      fontSize: ScreenAdapter.sp(30),
                      color: ThemeColors.colorType6,
                    ),
                    recognizer: TapGestureRecognizer()
                      ..onTap = () async {
                        LRouter.navigatorCtx(context).push(Routes.protocolPage,
                            arguments: ProtocolPageArguments(
                                protocolType: AppConstant.PROTOCOL_USER));
                      }),
                TextSpan(
                  text: '和',
                  style: TextStyle(
                    fontSize: ScreenAdapter.sp(30),
                    color: ThemeColors.colorType1,
                  ),
                ),
                TextSpan(
                    text: '《隐私政策》',
                    style: TextStyle(
                      fontSize: ScreenAdapter.sp(30),
                      color: ThemeColors.colorType6,
                    ),
                    recognizer: TapGestureRecognizer()
                      ..onTap = () async {
                        LRouter.navigatorCtx(context).push(Routes.protocolPage,
                            arguments: ProtocolPageArguments(
                                protocolType: AppConstant.PROTOCOL_PRIVACY));
                      }),
                TextSpan(
                  text:
                      '''帮助您了解我们收集、使用和存储个人信息的情况，以及您所享有的相关权利。\n1.为了向你提供招标信息查看、订阅等服务，我们需要收集您的查看历史、设备信息、等个人信息；\n2.您可以在个人中心页面访问和更正您的个人信息并管理您的授权；\n3.我们会采用业界领先的安全技术保护好您的个人信息。\n如果您同意，请点击“同意”开始接受我们的服务。''',
                  style: TextStyle(
                    fontSize: ScreenAdapter.sp(30),
                    color: ThemeColors.colorType1,
                  ),
                ),
              ],
            ))),
        Row(mainAxisAlignment: MainAxisAlignment.center, children: [
          Container(
              width: ScreenAdapter.width(210),
              height: ScreenAdapter.height(66),
              alignment: Alignment.center,
              decoration: BoxDecoration(
                  color: ThemeColors.colorWhite,
                  border: Border.all(color: ThemeColors.colorType36, width: 1),
                  borderRadius: BorderRadius.circular(ScreenAdapter.width(35))),
              child: GestureDetector(
                  onTap: () {
                    // LRouter.navigatorCtx(context)
                    //     .pop(AppConstant.DIALOG_ACTION_CANCEL);
                    exit(0);
                  },
                  child: Text("不同意",
                      style: TextStyle(
                          color: ThemeColors.colorType7,
                          fontSize: ScreenAdapter.sp(32))))),
          SizedBox(width: ScreenAdapter.width(30)),
          Container(
              width: ScreenAdapter.width(210),
              height: ScreenAdapter.height(66),
              alignment: Alignment.center,
              decoration: BoxDecoration(
                  color: ThemeColors.colorType6, // 底色
                  borderRadius: BorderRadius.circular(ScreenAdapter.width(35))),
              child: GestureDetector(
                  onTap: () {
                    LRouter.navigatorCtx(context)
                        .pop(AppConstant.DIALOG_ACTION_CONFIRM);
                  },
                  child: Text("同意并使用",
                      style: TextStyle(
                          color: ThemeColors.colorWhite,
                          fontSize: ScreenAdapter.sp(32))))),
        ])
      ]),
    ));
  }
}
